package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import com.atguigu.springcloud.service.PaymentFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.concurrent.CompletableFuture;

/**
 * @Author: shikong
 * @Date: 2020/7/29 11:23
 */

@RestController
public class PaymengController {


    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult insertPayment(@PathVariable long id){

        CommonResult<Payment> payment= paymentFeignService.insertPayment(id);
        if (null != payment){
            return new CommonResult(200,"successufl,port:"+payment);
        }else {
            return new CommonResult(444,"error",null);
        }
    }

    @GetMapping("/consumer/payment/feign/timeout")
    public String paymentFeignTimeout(){

        return paymentFeignService.paymentFeignTimeout();
    }


}
